Skip to content

Move fast paths around to gain a bit of new-solver perf#158249

Merged
rust-bors[bot] merged 10 commits into
rust-lang:mainfrom
jdonszelmann:move-checks
Jul 16, 2026
Merged

Move fast paths around to gain a bit of new-solver perf#158249
rust-bors[bot] merged 10 commits into
rust-lang:mainfrom
jdonszelmann:move-checks

Conversation

@jdonszelmann

@jdonszelmann jdonszelmann commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Change in % compared to previous commit on 4 benchmarks. All measured locally on ragdoll (AMD RYZEN 3990X, x86_64). These benchmarks have been quite repeatable in the past, but don't exactly match perf runs. All benchmarks show change in instruction count
First change is compared to baseline
Commit ids may change on rebases, so these links may become outdated.

nalgebra [check,debug,opt] serde [check,debug, opt] syn [check, debug, opt] wg-grammar [check, debug, opt]
move overflow check $${\color{green}-0.04\%}$$
$${\color{green}-0.03\%}$$
$${\color{green}-0.02\%}$$
$${\color{green}-0.15\%}$$
$${\color{green}-0.12\%}$$
$${\color{green}-0.11\%}$$
$${\color{green}-0.08\%}$$
$${\color{green}-0.04\%}$$
$${\color{green}-0.01\%}$$
$${\color{green}-0.32\%}$$
$${\color{green}-0.31\%}$$
$${\color{green}-0.29\%}$$
move fast path into evaluate_goal $${\color{red}+0.61\%}$$
$${\color{red}+0.60\%}$$
$${\color{red}+0.43\%}$$
$${\color{red}+0.75\%}$$
$${\color{red}+0.69\%}$$
$${\color{red}+0.65\%}$$
$${\color{red}+0.55\%}$$
$${\color{red}+0.36\%}$$
$${\color{red}+0.14\%}$$
$${\color{red}+0.13\%}$$
$${\color{red}+0.21\%}$$
$${\color{red}+0.15\%}$$
remove fastpath from fullfilment loop $${\color{red}+0.56\%}$$
$${\color{red}+0.50\%}$$
$${\color{red}+0.35\%}$$
$${\color{red}+3.33\%}$$
$${\color{red}+2.76\%}$$
$${\color{red}+2.55\%}$$
$${\color{red}+1.65\%}$$
$${\color{red}+0.93\%}$$
$${\color{red}+0.33\%}$$
$${\color{green}-5.06\%}$$
$${\color{green}-5.00\%}$$
$${\color{green}-4.65\%}$$
return stalled info from fast path $${\color{red}+0.16\%}$$
$${\color{red}+0.16\%}$$
$${\color{red}+0.12\%}$$
$${\color{red}+0.01\%}$$
$${\color{red}+0.01\%}$$
$${\color{red}+0.01\%}$$
$${\color{red}+0.24\%}$$
$${\color{red}+0.15\%}$$
$${\color{red}+0.05\%}$$
$${\color{green}-0.24\%}$$
$${\color{green}-0.24\%}$$
$${\color{green}-0.25\%}$$
move goal fast path into evaluate_goal_cold $${\color{red}+0.01\%}$$
$${\color{red}+0.01\%}$$
$${\color{red}+0.01\%}$$
$${\color{red}+0.02\%}$$
$${\color{red}+0.02\%}$$
$${\color{red}+0.02\%}$$
$${\color{red}+0.02\%}$$
$${\color{red}+0.02\%}$$
$${\color{red}+0.01\%}$$
$${\color{green}-0.01\%}$$
$${\color{green}-0.01\%}$$
$${\color{green}-0.01\%}$$
shuffle fastpaths around to before creating an evalctxt $${\color{green}-0.44\%}$$
$${\color{green}-0.41\%}$$
$${\color{green}-0.30\%}$$
$${\color{green}-2.31\%}$$
$${\color{green}-1.93\%}$$
$${\color{green}-1.80\%}$$
$${\color{green}-1.29\%}$$
$${\color{green}-0.77\%}$$
$${\color{green}-0.29\%}$$
$${\color{green}-6.06\%}$$
$${\color{green}-5.90\%}$$
$${\color{green}-5.48\%}$$
fast path when adding goals $${\color{green}-0.62\%}$$
$${\color{green}-0.58\%}$$
$${\color{green}-0.41\%}$$
$${\color{green}-0.78\%}$$
$${\color{green}-0.66\%}$$
$${\color{green}-0.61\%}$$
$${\color{green}-0.36\%}$$
$${\color{green}-0.28\%}$$
$${\color{green}-0.10\%}$$
$${\color{green}-0.12\%}$$
$${\color{green}-0.09\%}$$
$${\color{green}-0.04\%}$$
overall from baseline $${\color{red}+0.24\%}$$
$${\color{red}+0.23\%}$$
$${\color{red}+0.16\%}$$
$${\color{red}+0.79\%}$$
$${\color{red}+0.70\%}$$
$${\color{red}+0.66\%}$$
$${\color{red}+0.60\%}$$
$${\color{red}+0.36\%}$$
$${\color{red}+0.13\%}$$
$${\color{green}-11.31\%}$$
$${\color{green}-11.00\%}$$
$${\color{green}-10.27\%}$$

View all comments

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver) labels Jun 22, 2026
@jdonszelmann

Copy link
Copy Markdown
Contributor Author

This tests a bunch of changes together. I've done diffs locally suggesting ~5% speedup across these 7 commits. Moving fast path checks to evaluate_goal_raw ~2%, making it return stalled_on another 3% or so and using TyOrConstInferVar ~0.5%

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 22, 2026
rust-bors Bot pushed a commit that referenced this pull request Jun 22, 2026
Move fast path checks to `evaluate_goal_raw`
@rust-bors

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@rust-bors

rust-bors Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: 3f4f44d (3f4f44d99c410d3aadeb2731ddd6c5446c89eb72)
Base parent: 9030e34 (9030e345fe92df1ccefd0a8cdf61a9a9a5b73cb0)

@rust-timer

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (3f4f44d): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.1% [0.1%, 3.7%] 18
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.9% [-4.9%, -0.0%] 5
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 0.6%, secondary 1.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
2.7% [2.7%, 2.7%] 1
Regressions ❌
(secondary)
2.2% [1.7%, 2.7%] 9
Improvements ✅
(primary)
-1.4% [-1.4%, -1.4%] 1
Improvements ✅
(secondary)
-1.2% [-1.2%, -1.1%] 2
All ❌✅ (primary) 0.6% [-1.4%, 2.7%] 2

Cycles

Results (secondary 3.2%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
4.1% [2.1%, 6.2%] 6
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-2.3% [-2.3%, -2.3%] 1
All ❌✅ (primary) - - 0

Binary size

Results (primary 0.0%, secondary 0.1%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
0.0% [0.0%, 0.0%] 4
Regressions ❌
(secondary)
0.1% [0.0%, 0.1%] 20
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.0% [0.0%, 0.0%] 4

Bootstrap: 503.321s -> 505.38s (0.41%)
Artifact size: 353.40 MiB -> 353.04 MiB (-0.10%)

@rustbot rustbot added perf-regression Performance regression. and removed S-waiting-on-perf Status: Waiting on a perf run to be completed. labels Jun 22, 2026
Comment thread compiler/rustc_infer/src/infer/context.rs Outdated
@jdonszelmann jdonszelmann force-pushed the move-checks branch 2 times, most recently from c340366 to 987b1a0 Compare June 25, 2026 13:16
@jdonszelmann

Copy link
Copy Markdown
Contributor Author

@bors try @rust-timer queue

@rust-timer

This comment has been minimized.

@rustbot rustbot added the S-waiting-on-perf Status: Waiting on a perf run to be completed. label Jun 25, 2026
@rust-bors

This comment has been minimized.

rust-bors Bot pushed a commit that referenced this pull request Jun 25, 2026
Move fast path checks to `evaluate_goal_raw`
@rustbot rustbot added A-tidy Area: The tidy tool T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jun 25, 2026
@rust-bors

rust-bors Bot commented Jun 25, 2026

Copy link
Copy Markdown
Contributor

☀️ Try build successful (CI)
Build commit: b2fad67 (b2fad672d15ed85bb352e25461a99b01bf10a0de)
Base parent: 973ad0d (973ad0d0ab149bde2e96422833c1265c7a5be217)

@rust-timer

This comment has been minimized.

@rust-bors

This comment has been minimized.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (b2fad67): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Benchmarking means the PR may be perf-sensitive. It's automatically marked not fit for rolling up. Overriding is possible but disadvised: it risks changing compiler perf.

Next, please: If you can, justify the regressions found in this try perf run in writing along with @rustbot label: +perf-regression-triaged. If not, fix the regressions and do another perf run. Neutral or positive results will clear the label automatically.

@bors rollup=never
@rustbot label: -S-waiting-on-perf +perf-regression

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.6% [0.2%, 1.2%] 12
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-6.9% [-11.7%, -2.0%] 6
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (primary 4.0%, secondary 3.3%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
4.0% [3.4%, 4.7%] 2
Regressions ❌
(secondary)
4.8% [0.9%, 22.7%] 7
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-1.6% [-2.4%, -0.9%] 2
All ❌✅ (primary) 4.0% [3.4%, 4.7%] 2

Cycles

Results (secondary -6.6%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-6.6% [-8.2%, -2.1%] 4
All ❌✅ (primary) - - 0

Binary size

Results (secondary 0.0%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
0.0% [0.0%, 0.0%] 1
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) - - 0

Bootstrap: 509.16s -> 507.92s (-0.24%)
Artifact size: 353.81 MiB -> 353.75 MiB (-0.02%)

Comment thread compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs Outdated
Comment thread compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs Outdated
Comment thread compiler/rustc_next_trait_solver/src/solve/eval_ctxt/mod.rs Outdated
@rustbot

rustbot commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

Comment thread compiler/rustc_trait_selection/src/solve/delegate.rs Outdated

@lcnr lcnr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jdonszelmann

Copy link
Copy Markdown
Contributor Author

@bors r=lcnr rollup=never (perf)

@rust-bors

rust-bors Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

📌 Commit a572787 has been approved by lcnr

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 16, 2026
@rust-bors

This comment has been minimized.

@rust-bors rust-bors Bot added merged-by-bors This PR was explicitly merged by bors. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jul 16, 2026
@rust-bors

rust-bors Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

☀️ Test successful - CI
Approved by: lcnr
Duration: 3h 46m 23s
Pushing a6050b7 to main...

@github-actions

Copy link
Copy Markdown
Contributor
What is this? This is an experimental post-merge analysis report that shows differences in test outcomes between the merged PR and its parent PR.

Comparing d62fb1c (parent) -> a6050b7 (this PR)

Test differences

No test diffs found

Test dashboard

Run

cargo run --manifest-path src/ci/citool/Cargo.toml -- \
    test-dashboard a6050b7ea848e25289bf097c606e0611c58ef4f3 --output-dir test-dashboard

And then open test-dashboard/index.html in your browser to see an overview of all executed tests.

Job duration changes

  1. dist-aarch64-apple: 1h 20m -> 2h 9m (+61.3%)
  2. x86_64-msvc-ext2: 1h 22m -> 1h 51m (+35.6%)
  3. i686-gnu-nopt-2: 1h 42m -> 2h 19m (+35.2%)
  4. dist-x86_64-llvm-mingw: 1h 27m -> 1h 57m (+34.8%)
  5. x86_64-mingw-1: 2h 17m -> 3h 2m (+33.4%)
  6. x86_64-gnu-debug: 1h 35m -> 2h 1m (+28.3%)
  7. dist-powerpc-linux: 1h 11m -> 1h 30m (+25.9%)
  8. i686-gnu-nopt-1: 2h 27m -> 1h 49m (-25.2%)
  9. dist-x86_64-msvc: 2h 7m -> 1h 35m (-24.6%)
  10. x86_64-gnu-llvm-21-2: 1h 41m -> 1h 17m (-24.2%)
How to interpret the job duration changes?

Job durations can vary a lot, based on the actual runner instance
that executed the job, system noise, invalidated caches, etc. The table above is provided
mostly for t-infra members, for simpler debugging of potential CI slow-downs.

@rust-timer

Copy link
Copy Markdown
Collaborator

Finished benchmarking commit (a6050b7): comparison URL.

Overall result: ❌✅ regressions and improvements - please read:

Our benchmarks found a performance regression caused by this PR.
This might be an actual regression, but it can also be just noise.

Next Steps:

  • If the regression was expected or you think it can be justified,
    please write a comment with sufficient written justification, and add
    @rustbot label: +perf-regression-triaged to it, to mark the regression as triaged.
  • If you think that you know of a way to resolve the regression, try to create
    a new PR with a fix for the regression.
  • If you do not understand the regression or you think that it is just noise,
    you can ask the @rust-lang/wg-compiler-performance working group for help (members of this group
    were already notified of this PR).

@rustbot label: +perf-regression
cc @rust-lang/wg-compiler-performance

Instruction count

Our most reliable metric. Used to determine the overall result above. However, even this metric can be noisy.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.2% [0.2%, 2.2%] 11
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.1% [-8.4%, -1.5%] 6
All ❌✅ (primary) - - 0

Max RSS (memory usage)

Results (secondary -1.9%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
1.0% [0.8%, 1.1%] 4
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-5.7% [-9.0%, -3.1%] 3
All ❌✅ (primary) - - 0

Cycles

Results (secondary -1.8%)

A less reliable metric. May be of interest, but not used to determine the overall result above.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
2.9% [2.2%, 3.6%] 3
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-4.6% [-6.6%, -2.3%] 5
All ❌✅ (primary) - - 0

Binary size

This perf run didn't have relevant results for this metric.

Bootstrap: 489.85s -> 492.034s (0.45%)
Artifact size: 389.48 MiB -> 390.08 MiB (0.15%)

@nnethercote

Copy link
Copy Markdown
Contributor

(Friendly suggestion for next time: don't put the big table of results in the PR description because it ends up in the merge commit message and looks ugly in git log output :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-tidy Area: The tidy tool merged-by-bors This PR was explicitly merged by bors. perf-regression Performance regression. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative (-Znext-solver)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants